package org.example.env_boot.repository;

import org.example.env_boot.entity.GridProvince;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

/**
 * 省区域数据访问接口
 */
@Repository
public interface GridProvinceRepository extends JpaRepository<GridProvince, Integer> {
    
    /**
     * 根据省名称查找
     */
    Optional<GridProvince> findByProvinceName(String provinceName);
    
    /**
     * 根据省简称查找
     */
    Optional<GridProvince> findByProvinceAbbr(String provinceAbbr);
    
    /**
     * 获取所有省区域，按名称排序
     */
    List<GridProvince> findAllByOrderByProvinceNameAsc();
} 